package com.lincoln.cloud.servercenter.protocol;

import com.lincoln.cloud.common.utils.CommondValue;
import com.lincoln.cloud.servercenter.abstracter.NettyCommunicationProtocol;
import com.lincoln.framework.annotation.Execute;
import com.lincoln.framework.annotation.ExecuteTypeEnum;
import com.lincoln.framework.bean.AbstractMsgNoExecute;
import com.lincoln.framework.interfaces.BaseProtocol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 心跳指令{[no]|心跳|0|[md5]}
 *
 * @author lincoln
 */
@Execute(deviceType = 1, protocolType = 1, executeType = ExecuteTypeEnum.HEART_BEAT)
public class HeartBeat extends AbstractMsgNoExecute {
    private static final Logger logger = LoggerFactory.getLogger(HeartBeat.class);

    @Override
    public byte[] getServerCmd() {
        return CommondValue.HEART_BEAT_SERVER_CMD.getBytes();
    }

    @Override
    public byte[] getClientCmd() {
        return CommondValue.HEART_BEAT_CLIENT_CMD.getBytes();
    }

    @Override
    public boolean execute(BaseProtocol baseProtocol) {
        return new NettyCommunicationProtocol().checkHeart();
    }

    @Override
    public Logger getLogger() {
        return logger;
    }
}
